home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Arsenal Files 4
/
The Arsenal Files 4 (Arsenal Computer).ISO
/
ham
/
sattrk31.tgz
/
sattrack-3.1.tar
/
SatTrack
/
src
/
sattrack
/
satmath.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-03-16
|
4KB
|
81 lines
/******************************************************************************/
/* */
/* Title : satmath.c */
/* Author : Manfred Bester */
/* Date : 13Dec94 */
/* Last change : 15Mar95 */
/* */
/* Synopsis : Auxiliary math routines for the satellite tracking program */
/* SatTrack. */
/* */
/* */
/* SatTrack is Copyright (c) 1992, 1993, 1994, 1995 by Manfred Bester. */
/* All Rights Reserved. */
/* */
/* Permission to use, copy, and distribute SatTrack and its documentation */
/* in its entirety for educational, research and non-profit purposes, */
/* without fee, and without a written agreement is hereby granted, provided */
/* that the above copyright notice and the following three paragraphs appear */
/* in all copies. SatTrack may be modified for personal purposes, but */
/* modified versions may NOT be distributed without prior consent of the */
/* author. */
/* */
/* Permission to incorporate this software into commercial products may be */
/* obtained from the author, Dr. Manfred Bester, 1636 M. L. King Jr. Way, */
/* Berkeley, CA 94709, USA. Note that distributing SatTrack 'bundled' in */
/* with ANY product is considered to be a 'commercial purpose'. */
/* */
/* IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, */
/* SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF */
/* THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE AUTHOR HAS BEEN ADVISED */
/* OF THE POSSIBILITY OF SUCH DAMAGE. */
/* */
/* THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT */
/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A */
/* PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" */
/* BASIS, AND THE AUTHOR HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, */
/* UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */
/* */
/******************************************************************************/
#include <stdio.h>
#include <math.h>
#ifndef STDLIB
#include <stdlib.h>
#endif
#include "sattrack.h"
/******************************************************************************/
/* */
/* reduce: reduces number into specified interval (e.g. -PI, +PI) */
/* */
/******************************************************************************/
double reduce(value,rangeMin,rangeMax)
double value, rangeMin, rangeMax;
{
double range, rangeFrac, fullRanges, retval;
range = rangeMax - rangeMin;
rangeFrac = (rangeMax - value) / range;
modf(rangeFrac,&fullRanges);
retval = value + fullRanges * range;
if (retval > rangeMax)
retval -= range;
return(retval);
}
/******************************************************************************/
/* */
/* End of function block satmath.c */
/* */
/******************************************************************************/